package sample.positive.bean;

import java.util.List;

/**
 * 书架
 */
public class Shelf {
    private List<Book> books;

    public Shelf(List<Book> books) {
        this.books = books;
    }

    public List<Book> getBooks() {
        return books;
    }

    /**
     * 查找图书作者
     * @param title
     * @return
     */
    public String findBookAuthor(String title) {
        for (Book book : books) {
            if (book.getTitle().equals(title)) {
                return book.getAuthor();
            }
        }
        return null;
    }
}
